export default {
  name: 'routerLink',
  props: {  // 属性接收
    to: {
      type: String,
      required: true
    },
    tag: {
      type: String,
      default: 'a'
    }
  },  // 写组件库都可以使用jsx语法
  methods: {
    handler(to) {
      this.$router.history.push(to)
    }
  },
  render() {
    let { to, tag } = this
    return <tag onClick={this.handler.bind(this, to)}>{ this.$slots.default }</tag>
  }
}